package com.dong.common.core.pdf;

import com.itextpdf.text.Document;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.PdfPageEvent;
import com.itextpdf.text.pdf.PdfWriter;

public class ReportPdfPageEvent implements PdfPageEvent {
    @Override
    public void onOpenDocument(PdfWriter writer, Document document) {
        System.out.println(document.getId()+"onOpenDocument打开啦");
    }

    @Override
    public void onStartPage(PdfWriter writer, Document document) {
        System.out.println(document.getId()+"onStartPage启动啦");
    }

    @Override
    public void onEndPage(PdfWriter writer, Document document) {
        System.out.println(document.getId()+"onEndPage结束啦");
    }

    @Override
    public void onCloseDocument(PdfWriter writer, Document document) {
        System.out.println(document.getId()+"onCloseDocument关闭啦");
    }

    @Override
    public void onParagraph(PdfWriter writer, Document document, float paragraphPosition) {
        System.out.println(document.getId()+"onParagraph开始写入内容啦，内容位置："+paragraphPosition);
    }

    @Override
    public void onParagraphEnd(PdfWriter writer, Document document, float paragraphPosition) {
        System.out.println(document.getId()+"onParagraphEnd结束写入内容啦");
    }

    @Override
    public void onChapter(PdfWriter writer, Document document, float paragraphPosition, Paragraph title) {
        System.out.println(document.getId()+"onChapter一章已经写完啦");
    }

    @Override
    public void onChapterEnd(PdfWriter writer, Document document, float paragraphPosition) {
        System.out.println(document.getId()+"onChapterEnd一章写完啦");
    }

    @Override
    public void onSection(PdfWriter writer, Document document, float paragraphPosition, int depth, Paragraph title) {
        System.out.println(document.getId()+"onSection关闭啦");
    }

    @Override
    public void onSectionEnd(PdfWriter writer, Document document, float paragraphPosition) {
        System.out.println(document.getId()+"onSectionEnd关闭啦");
    }

    @Override
    public void onGenericTag(PdfWriter writer, Document document, Rectangle rect, String text) {
        System.out.println(document.getId()+"onGenericTag关闭啦");
    }
}
